package com.why.controller;

import com.why.domain.Teacher;
import com.why.service.TeacherService;
import com.why.utils.Result;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Teacher)表控制层
 *
 * @author makejava
 * @since 2024-06-14 19:34:00
 */
@RestController
@RequestMapping("/teacher")
public class TeacherController {
    /**
     * 服务对象
     */
    @Resource
    private TeacherService teacherService;

    @PostMapping("/login")
    public Result login(@RequestBody Teacher teacher) {
        String token = teacherService.login(teacher);
        return Result.success(token);
    }

    @PostMapping("/register")
    public Result register(@RequestBody Teacher teacher) {
        teacherService.register(teacher);
        return Result.success();
    }
}

